How to pass JavaScript variables to PHP

40

js var to php -

<script>
   var res = "success";
</script>
<?php
   echo "<script>document.writeln(res);</script>";
?>

How to pass JavaScript variables to PHP? -

<script>
var p1 = "success";
</script>

<?php
echo "<script>document.writeln(p1);</script>";
?>

Comments

Submit
0 Comments